home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / rotate3d.doc < prev    next >
Text File  |  1995-03-31  |  4KB  |  127 lines

  1. (Comp.sys.handhelds) 
  2. Item: 1091 by cmeyer at milton.u.washington.edu 
  3. Author: [Colin Meyer] 
  4.   Subj: Rotate 3d objects on HP48 
  5.   Date: Fri Nov 09 1990 08:18  
  6.  
  7. Rotate 3d V1 for HP48's. 
  8.  
  9. Here is my nifty program for rotating three dimensional shapes. 
  10. It even does perspectives, but no hidden line removal. Maybe on V2. 
  11.  
  12. It is based on Three-Dimensional Graphics in Turbo Pascal, Computer  
  13. Language, Sept. 1990. 
  14.  
  15. The Programs/Variables: 
  16.  
  17.  SROTATE: start rotation. 
  18.  SANIMATE: save grobs on stack (in FRAMES), start animation. 
  19.  ANIMATE: start animation of previously saved grobs. 
  20.  FRAMES: a list of grobs to animate. 
  21.  OCTO: shape - an octohedron 
  22.  CONE: shape - actually a six sided pyramid 
  23.  CUBE: shape - cube! 
  24.   
  25. (Don't worry about the rest of the programs, they're just my strange 
  26.  attempt at modular programming!) 
  27.  
  28. Shapes are specified by a list of two lists, a list of vertices (3d  
  29. vectors) and a list of lines between vertices: 
  30.  
  31. { { [x1 y1 z1] 
  32.     [x2 y2 z2] 
  33.     ... 
  34.     [xn yn zn] } 
  35.   { v1 v2 
  36.     v3 v4 
  37.     ... 
  38.     vn vn+1 } } 
  39.  
  40. Each pair of vertices in the line list specifies one line. For instance,  
  41. { 1 2 } would be a list with only one line, between vertex 1 and vertex 2. 
  42. { 1 2 2 3} would be a list with two lines, the first between vertices 1 
  43. and 2, and the second between vertices 2 and 3. 
  44.  
  45. To Use: 
  46.  
  47. 1: shape (list of lists, as described about) 
  48.  
  49. [SROTATE] 
  50.  
  51. The Initial View is how the object is initially oriented. 
  52. The object will be rotated on the third axis (the one not chosen for one  
  53. of the initial rotations). 
  54. X axis = 1, Y axis = 2, Z = 3. 
  55.  
  56. Distance views from: is in user units (try about the same as the width 
  57. of the screen). 
  58.  
  59. Rotation options: are as follows: 
  60.  
  61. :Start\<): - the angle to start the rotation at. 
  62. :End\<): - the angle to end the rotation at. 
  63. :inc: - the increment of the angle between views. 
  64.  
  65. (to do a complete circle, start at 0 degrees, end at 351 and do an  
  66.  increment of 9 - I've found 9 degrees is a small enough jump for smooth 
  67.  animation.) 
  68.  
  69. Rotate on new or  
  70. original axes? 
  71.  
  72. -this refers to the initial view. Before that view is the original axes,  
  73.  during that view is the new axes. Confused? Just try both ways & you'll 
  74.  understand. 
  75.  
  76. Save as grobs for  
  77. later animation? 
  78.  
  79. -self explanatory. 
  80.  If you do choose to save grobs, You'll have to choose how big a grob to  
  81.  save. The program will draw the first frame, and prompt you for corners 
  82.  of the grob to save. Move the cursor to each corner, and press [ENTER] 
  83.  at each. Make sure to make the grob a bit bigger than the picture,  
  84.  because as it rotates, it may go out of close boundaries. After marking 
  85.  corners, you must push [ATTN], then [ORANGE] [CONT]. 
  86.  
  87. The program will then go ahead and draw all the frames, saving them as  
  88. grobs on the stack if you chose so.  
  89.  
  90. When you end up with a bunch of grobs on the stack, Press [SANIMATE] to 
  91. save them in the variable FRAMES and then animate them. 
  92.  
  93. Whenever you already have grobs saved in FRAMES, just press [ANIMATE].      
  94.  
  95. To start, try a cube, and these options: 
  96.  
  97. 1: (the cube) 
  98.  
  99. [SROTATE] 
  100.  
  101. :Axis1:1 
  102. :\<)1:30 [ENTER] 
  103.  
  104. :Axis2:2 
  105. :\<)2:30 [ENTER]  
  106.  
  107. Distance viewed from: 
  108.  
  109. 7 [ENTER] 
  110.  
  111. Rotation options: 
  112. :Start\<):0 
  113. :End\<):351 
  114. :inc:9 [ENTER] 
  115.  
  116. Rotate on new or  
  117. original axes? 
  118.  
  119. [ORIG] 
  120.  
  121. Save as grobs for  
  122. later animation? 
  123.  
  124. [NO] 
  125.  
  126. (sit back and enjoy). 
  127.